﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed), ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)]
    public class VASServices : IVASServices
    {
        public string DeleteOperationInfo(List<string> operationIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OperationBLL(pubParasInfo).Delete(operationIDs);
                new OperationLogBLL(pubParasInfo).Insert("VASServices_DeleteOperationInfo", operationIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string DeleteWorkCenterInfo(List<string> workCenterIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new WorkCenterBLL(pubParasInfo).Delete(workCenterIDs);
                new OperationLogBLL(pubParasInfo).Insert("VASServices_DeleteWorkCenterInfo", workCenterIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public DataSet GetAllOperation(PubParasInfo pubParasInfo)
        {
            try
            {
                OperationBLL operationll = new OperationBLL(pubParasInfo);
                return operationll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetAllWorkCenter(PubParasInfo pubParasInfo)
        {
            try
            {
                WorkCenterBLL workCenterBll = new WorkCenterBLL(pubParasInfo);
                return workCenterBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetOperationByQueryEntity(OperationQueryEntity operationQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                OperationBLL operationll = new OperationBLL(pubParasInfo);
                return operationll.GetInfoByQueryEntity(operationQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public OperationInfo GetOperationInfoByID(string operationID, PubParasInfo pubParasInfo)
        {
            try
            {
                OperationBLL operationll = new OperationBLL(pubParasInfo);
                return operationll.GetInfoByID(operationID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetWorkCenterByQueryEntity(WorkCenterQueryEntity workCenterQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                WorkCenterBLL workCenterBll = new WorkCenterBLL(pubParasInfo);
                return workCenterBll.GetInfoByQueryEntity(workCenterQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public WorkCenterInfo GetWorkCenterInfoByID(string workCenterID, PubParasInfo pubParasInfo)
        {
            try
            {
                WorkCenterBLL workCenterBll = new WorkCenterBLL(pubParasInfo);
                return workCenterBll.GetInfoByID(workCenterID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public string InsertOperationInfo(OperationInfo operationInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OperationBLL(pubParasInfo).Insert(operationInfo);
                new OperationLogBLL(pubParasInfo).Insert("VASServices_InsertOperationInfo", operationInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string InsertWorkCenterInfo(WorkCenterInfo workCenter, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new WorkCenterBLL(pubParasInfo).Insert(workCenter);
                new OperationLogBLL(pubParasInfo).Insert("VASServices_InsertWorkCenterInfo", workCenter, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateOperationInfo(OperationInfo operationInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OperationBLL(pubParasInfo).Update(operationInfo);
                new OperationLogBLL(pubParasInfo).Insert("VASServices_UpdateOperationInfo", operationInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateWorkCenterInfo(WorkCenterInfo workCenter, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new WorkCenterBLL(pubParasInfo).Update(workCenter);
                new OperationLogBLL(pubParasInfo).Insert("VASServices_UpdateWorkCenterInfo", workCenter, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }
    }
}

